<template>
    <div id="my">
        <div class="my-bak">
            <div class="log-box" v-if="show2"></div>
            <HeadPortrait></HeadPortrait>
            <FunctionBar></FunctionBar>
            <MyOrder></MyOrder>
            <div class="user-name">{{get}}</div>
            <div class="rm-sin" v-if="show1" @click="removes">退出登录</div>
            <PersonalCenter></PersonalCenter>
        </div>
         <Bar>
            <Baritme  path='/home' acColor='#ff5000'>
                <van-icon name="bag-o" slot="baritme-ico" size="27px" />
                <van-icon
                    name="bag-o"
                    
                    slot="baritme-ico-active"
                    color="#ff5000"
                    size="27px"
                />
                <div slot="baritme-text">首页</div>
            </Baritme>
            <Baritme  path='/classification' acColor='#ff5000'>
                <van-icon name="send-gift-o"  slot="baritme-ico" size="27px" />
                <van-icon
                    name="send-gift-o"
                    
                    slot="baritme-ico-active"
                    color="#ff5000"
                    size="27px"
                />
                <div slot="baritme-text">分类</div>
            </Baritme>
            <Baritme path='/shoppin' acColor='#ff5000'>
                <van-icon name="shopping-cart-o" slot="baritme-ico" size="27px" />
                <van-icon
                    name="shopping-cart-o"
                   
                    slot="baritme-ico-active"
                    color="#ff5000"
                    size="27px"
                />
                <div slot="baritme-text">购物车</div>
            </Baritme>
            <Baritme path='/my' acColor='#ff5000'>
                <van-icon name="manager-o" slot="baritme-ico" size="27px" />
                <van-icon
                    name="manager-o"
                    
                    slot="baritme-ico-active"
                    color="#ff5000"
                    size="27px"
                />

                <div slot="baritme-text">我的</div>
            </Baritme>
        </Bar>
    </div>
    
</template>


<script>
import HeadPortrait from "../components/taobao/HeadPortrait";
import MyOrder from "../components/taobao/MyOrder"; 
import FunctionBar from "../components/taobao/FunctionBar";
import PersonalCenter from "../components/taobao/PersonalCenter";
import Baritme from "../components/common/Baritme";
import Bar from "../components/common/Bar";

export default {
    name: "My",
    data() {
        return {
            get: '',
            show1: '',
            show2: 'true'
        }
    },
    created() {
        this.getname();
    },
    methods: {
        // 获取储存在本地文件的用户名
        getname() {
            if(localStorage.getItem("user") != null) {
                const user = localStorage.getItem('user')
                const userData  = JSON.parse(user)
                this.get = userData["用户名"]
                this.show1 = 'true'
                this.show2 = ''
            }
        },
        removes() {
            localStorage.removeItem("user");
            this.get = '',
            this.show1= '',
            this.show2= 'true'
        }
    },
    components: {
        HeadPortrait,
        MyOrder,
        FunctionBar,
        PersonalCenter,
        Baritme,
        Bar
        
    }
};
</script>

<style scoped>
    .user-name {
        width: 150px;
        line-height: 50px;
        background-color: #ffffff;
        z-index: 99;
        position: absolute;
        top: 40px;
        left: 90px;
        font-size: 22px;
        color: #ff4800;
    }
    .rm-sin {
        line-height: 50px;
        background-color: #ffffff;
        position: absolute;
        top: 40px;
        right: 20px;
        font-size: 14px;
    }
    .log-box {
        width: 50px;
        height: 50px;
        position: absolute;
        top: 40px;
        left: 20px;
        z-index: 99;
        background-color: #999999;
        border-radius: 50%;
    }
    .my-bak {
        background-color: #ffffff;
    }
</style>